package com.example.demo.controller;

import com.example.demo.mq.producer.RabbitProducer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/mq")
public class RabbitMQController {
    private static final Logger log = LoggerFactory.getLogger(RabbitMQController.class);

    @Autowired
    private RabbitProducer rabbitProducer;

    @GetMapping("/sendDemoQueue")
    public Object sendDemoQueue(String msg){
        System.out.println("向队列发送消息...");
        rabbitProducer.sendDemoQueue(msg);
        return "success";
    }
}
